<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>用户管理</title>
<jsp:include page="include.jsp" />
<script type="text/javascript">

$(function(){
	$('#usertable').datagrid({
		url: 'query.form',
		title: '用户信息',
		width: 'auto',
		height: 'auto',
		rownumbers: true,
		fitColumns: true,
		singleSelect: true,
		fit:true,
		pagination: true, //是否显示底部分页工具栏
		pageNumber: 1,
		loadMsg: '正在加载用户数据.........',
		columns:[[
			{field:'name',title:'用户名',width:80,align:'center'},
			{field:'password',title:'密码',width:80,align:'center'},
			{field:'email',title:'email',width:100,align:'center'},
			{field:'attr1',title:'状态',width:50},
			{field:'status',title:'描述',width:200,align:'center'}
		]]
	});
});
function deleteUser(){
	var node = $('#usertable').datagrid("getSelected");
	if (node){
		$.ajax({
			  url: "delete.form",
			  data: 'id='+node.id,
			  success: function(text){
				  $.messager.alert('提示', text); 
				  var index = $('#usertable').datagrid('getRowIndex', node);
				  $('#usertable').datagrid('deleteRow', index);
			  },
			  error : function (text){
				  $.messager.alert('提示', '保存错误'); 
			  }
		});
	}
}
</script>
</head>
<body>
<body class="easyui-layout">  
    <div region="north"  title="查询条件" style="height:80px;  padding: 10px">
  		<form>
  			<lable>用户名</lable>
			<input type="text" name="name">
			<label>email</label>
			<input type="text"  name="email">
			<input type="button"  value="提   交">
		</form>
	</div>  
    <div region="center" >
    
   		 <table id="usertable"></table>
    </div>  
    
    <div region="south"   style="height:50px; padding: 10px">
    		<div style="text-align:center;">
    			<input type="button" value="删    除" onclick="deleteUser()">
    			<input type="button" value="修   改" onclick="save()">
    			<input type="button" value="保   存" onclick="save()">
    </div>
	</div>
</body>  
</body>
</html>